'use strict';
module.exports = (sequelize, DataTypes) => {
  const news = sequelize.define('news', {
    news_id: {
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      type: DataTypes.INTEGER
    },
    cy_id: {
      type: DataTypes.INTEGER,
    },
    news_title: {
      type: DataTypes.STRING
    },
    news_cover: {
      type: DataTypes.STRING
    },
    introduce: {
      type: DataTypes.STRING
    },
    article: {
      type: DataTypes.TEXT
    },
    created_at: {
      type: DataTypes.INTEGER
    }
  }, {
    timestamps: false
  });
  news.associate = function(models) {
    // associations can be defined here
    news.belongsTo(models.classify, {
      foreignKey: 'cy_id'
    });
  };
  return news;
};